<!DOCTYPE html>
<html lang="en">
<head>
   <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
   <meta charset="utf-8" />
   <meta name="description" content="overview &amp; stats" />
   <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
   <title>Epoch权限管理系统</title>
   <link rel="stylesheet" href="${baseStaticUrl}/plugins/bootstrap/css/bootstrap.min.css">
   <link rel="stylesheet" href="${baseStaticUrl}/plugins/font-awesome-4.7.0/css/font-awesome.min.css">
   <link rel="stylesheet" href="${baseStaticUrl}/ace/css/ace.min.css">
   <link rel="stylesheet" href="${baseStaticUrl}/ace/css/ace-rtl.min.css">
   <link rel="stylesheet" href="${baseStaticUrl}/ace/css/ace-skins.min.css">
   <script src="${baseStaticUrl}/plugins/jquery/jquery-2.2.3.min.js"></script>
   <script type="text/javascript" src="${basePath}/js/common/MessageBox.js"></script>
   <script src="${basePath}/js/common/common.js"></script>
   <script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
</head>
<body class="no-skin">
	<div id="navbar" class="navbar navbar-default ace-save-state">
		<div class="navbar-container ace-save-state" id="navbar-container">
			<button type="button" class="navbar-toggle menu-toggler pull-left" id="menu-toggler" data-target="#sidebar">
				<span class="sr-only">Toggle sidebar</span>

				<span class="icon-bar"></span>

				<span class="icon-bar"></span>

				<span class="icon-bar"></span>
			</button>
			<div class="navbar-header pull-left">
				<a href="javascript:void(0)" class="navbar-brand">
					<small>
						<i class="fa fa-leaf"></i>
						Epoch<font size="2">(1.0开源版本)</font>
					</small>
				</a>
			</div>
			<div class="navbar-buttons navbar-header pull-right" role="navigation">
				<ul class="nav ace-nav">
					<li class="dropdown ">
			            <a href="${basePath}/index/index" target= _blank>
			              <i class="fa fa-home"></i>首页
			            </a>
			        </li>

					<li class="green dropdown-modal">
						<a data-toggle="dropdown" class="dropdown-toggle" href="#">
							<i class="ace-icon fa fa-envelope icon-animated-vertical"></i>
							<span class="badge badge-success">${infoCount!"0"}</span>
						</a>
						<ul class="dropdown-menu-right dropdown-navbar dropdown-menu dropdown-caret dropdown-close">
							<li class="dropdown-header">
								<i class="ace-icon fa fa-envelope-o"></i>
								${infoCount!"0"}条消息公告
							</li>
							<li class="dropdown-content">
								<ul class="dropdown-menu dropdown-navbar">
									@for(info in infoList){
									<li>
										<a href="javascript:void(0)"  class="clearfix" style="cursor:default">
											<span class="msg-body">
												<span class="msg-title">
													<span class="blue">${lisFun.escapeForQuot(lisFun.getDictCode('SYS_INFO_TYPE',info.INFO_TYPE))}:</span>
													${info.INFO_DESC!}
												</span>

												<span class="msg-time">
													<i class="ace-icon fa fa-clock-o"></i>
													<span>${info.UPDATE_DATE!,dateFormat="yyyy-MM-dd HH:mm:ss"}</span>
												</span>
											</span>
										</a>
									</li>
									@}
								</ul>
							</li>
							<li class="dropdown-footer">
								<a href="javascript:void(0)" onclick="toAllMessage()">
									查看全部
									<i class="ace-icon fa fa-arrow-right"></i>
								</a>
							</li>
						</ul>
					</li>
					<li class="light-blue dropdown-modal">
						<a data-toggle="dropdown" href="#" class="dropdown-toggle">
							<img class="nav-user-photo" src="${baseStaticUrl}/adminlte/img/user2-160x160.jpg" alt="Jason's Photo" />
							<span class="user-info">
								<small>你好,</small>
								${session.userInfo.user_name!}
							</span>
							<i class="ace-icon fa fa-caret-down"></i>
						</a>
						<ul class="user-menu dropdown-menu-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
							<li>
								<a href="javascript:void(0)" onclick="updatePassword()">
									<i class="ace-icon fa fa-cog"></i>
									修改密码
								</a>
							</li>
							<!-- <li>
								<a href="profile.html">
									<i class="ace-icon fa fa-user"></i>
									个人信息
								</a>
							</li> -->
							<li>
								<a href="javascript:void(0)" onclick="changeEpochStyle()">
									<i class="ace-icon fa fa-user"></i>
									首页风格
								</a>
							</li>
							<li class="divider"></li>
							<li>
								<a href="${basePath}/logout">
									<i class="ace-icon fa fa-power-off"></i>
									退出
								</a>
							</li>
						</ul>
					</li>
				</ul>
			</div>
		</div>
	</div>
	<div class="main-container ace-save-state" id="main-container">
		<script type="text/javascript">
				try{ace.settings.loadState('main-container')}catch(e){}
		</script>
		<div id="sidebar" class="sidebar responsive ace-save-state">
			<script type="text/javascript">
				try{ace.settings.loadState('sidebar')}catch(e){}
			</script>
			<div class="sidebar-shortcuts" id="sidebar-shortcuts">
				<div class="sidebar-shortcuts-large" id="sidebar-shortcuts-large">
					<button class="btn btn-success">
						<i class="ace-icon fa fa-signal"></i>
					</button>

					<button class="btn btn-info">
						<i class="ace-icon fa fa-pencil"></i>
					</button>

					<button class="btn btn-warning">
						<i class="ace-icon fa fa-users"></i>
					</button>

					<button class="btn btn-danger">
						<i class="ace-icon fa fa-cogs"></i>
					</button>
				</div>
				<div class="sidebar-shortcuts-mini" id="sidebar-shortcuts-mini">
					<span class="btn btn-success"></span>
					<span class="btn btn-info"></span>
					<span class="btn btn-warning"></span>
					<span class="btn btn-danger"></span>
				</div>
			</div>
			<ul class="nav nav-list">
				<epoch:menu></epoch:menu>
			</ul>
		</div>
		<div class="main-content epochContent">
			<iframe scrolling="yes" name="main" frameborder="0" style="width:100%;height:100%;overflow:visible;background:#fff;" src="${basePath}/index/main"></iframe>
		</div>
	</div>
	<epoch:winOpen id="epochStyleChange" title="风格切换" backdrop="false" width="380px" btnSave="确定">
	      <table  id="cardetail" class="table table-bordered">
	      		<tbody id="car">
					<tr class="table-list">
						<td width="340px">首页风格</td>
						<tr class="table-list">
							<td><input type="radio" value="ace" id="indexStyle" name="indexStyle">Ace风格</td>
						</tr>
						<tr class="table-list">
							<td><input type="radio" value="adminlte" id="indexStyle"  name="indexStyle">AdminLte风格</td>
						</tr>
						<tr class="table-list">
							<td><input type="radio" value="hplus" id="indexStyle"  name="indexStyle">H+风格</td>
						</tr>
					</tr>
				</tbody>
	      </table>
	</epoch:winOpen>
	<epoch:winOpen id="update_passsword" title="修改密码" backdrop="false" width="420px" btnSave="确定">
        <div class="row visa-row">
            <div id="wait-msg_common_password" class="alert alert-info"
                 style="background:url(${baseStaticUrl}/images/ajax-loader.gif) no-repeat scroll 0.5em 50%;display:none"></div>
            <div id="alert-msg_common_password" class="alert alert-success" style="display:none"></div>
            <div id="error-msg_common_password" class="alert alert-danger" style="display:none"></div>
        </div>
      <form class="form-horizontal">
          <div class="form-group">
	          	<label for="firstname" class="col-sm-3 control-label">原始密码</label>
				<div class="col-sm-8">
				<input type="password" class="form-control input-sm" name="passwordOld" id="passwordOld" autocomplete="off">
				</div>
         </div>
          <div class="form-group">
	          	<label for="firstname" class="col-sm-3 control-label">新密码</label>
				<div class="col-sm-8">
					<input type="password" class="form-control input-sm" name="passwordNew" id="passwordNew" autocomplete="off">
				</div>
          </div>
          <div class="form-group">
	          	<label for="firstname" class="col-sm-3 control-label">确认密码</label>
				<div class="col-sm-8">
				<input type="password" class="form-control input-sm" id="passwordNeWToo" autocomplete="off">
				</div>
          </div>
      </form>
	</epoch:winOpen>
   <script src="${baseStaticUrl}/ace/js/ace-extra.min.js"></script>
   <script src="${baseStaticUrl}/plugins/bootstrap/js/bootstrap.min.js"></script>
   <script src="${baseStaticUrl}/ace/js/jquery-ui.custom.min.js"></script>
   <script src="${baseStaticUrl}/ace/js/jquery.ui.touch-punch.min.js"></script>
   <script src="${baseStaticUrl}/ace/js/jquery.sparkline.min.js"></script>
   <script src="${baseStaticUrl}/ace/js/flot/jquery.flot.min.js"></script>
   <script src="${baseStaticUrl}/ace/js/flot/jquery.flot.pie.min.js"></script>
   <script src="${baseStaticUrl}/ace/js/flot/jquery.flot.resize.min.js"></script
   <script src="${basePath}/js/common/common.js"></script>
   <script src="${baseStaticUrl}/ace/js/ace-elements.min.js"></script>
   <script src="${baseStaticUrl}/ace/js/ace.min.js"></script>
	<script type="text/javascript">
		jQuery(function($) {
			$('.easy-pie-chart.percentage').each(function(){
				var $box = $(this).closest('.infobox');
				var barColor = $(this).data('color') || (!$box.hasClass('infobox-dark') ? $box.css('color') : 'rgba(255,255,255,0.95)');
				var trackColor = barColor == 'rgba(255,255,255,0.95)' ? 'rgba(255,255,255,0.25)' : '#E2E2E2';
				var size = parseInt($(this).data('size')) || 50;
				$(this).easyPieChart({
					barColor: barColor,
					trackColor: trackColor,
					scaleColor: false,
					lineCap: 'butt',
					lineWidth: parseInt(size/10),
					animate: /msie\s*(8|7|6)/.test(navigator.userAgent.toLowerCase()) ? false : 1000,
					size: size
				});
			});
			
			$('.sparkline').each(function(){
				var $box = $(this).closest('.infobox');
				var barColor = !$box.hasClass('infobox-dark') ? $box.css('color') : '#FFF';
				$(this).sparkline('html',
								 {
									tagValuesAttribute:'data-values',
									type: 'bar',
									barColor: barColor ,
									chartRangeMin:$(this).data('min') || 0
								 });
			});
			
		});
		
		$(function() {
			$("input[type='radio'][name='indexStyle']").eq(0).attr("checked",true);

		});
		
		function changeEpochStyle(){
			$("#epochStyleChange").modal('show');
		}
		
		function updatePassword(){
			$("#update_passsword").modal('show');
		}
		
		function toAllMessage(){
			window.location.hash = "/sys/info/index";
			window.main.location.href = getRootPath()+"/sys/info/index";
		}
		
		//获取所有选中的组织
	    $("#epochStyleChange_save").click(function () {
	    	var sessionStyle = "${session.EPOCHSTYLE!}";
	    	var checkStyle = $('input[name="indexStyle"]:checked').val();
	    	if(checkStyle == sessionStyle){
	    		MessageBox.error("已经是此样式，无需切换");
	    	}else{
	    		$.ajax({
		            url: "${basePath}/index/changeStyle",
		            data: {style:checkStyle},
		            type: "post",
		            success: function (result) {
		                if (result) {
		                    if (result.code == "0") {
		                    	MessageBox.success("样式切换成功，请重新刷新界面！");
		                    } 
		                }
		            },
		            error: function () {
		                MessageBox.error("服务器错误，请稍后再试！");
		            },
		            async: false
		        });
	    	}
	    	$("#epochStyleChange").modal('hide');
	    });
		
	    $("#update_passsword_save").click(function () {
	        var passwordOld = $("#passwordOld").val();
	        var passwordNew = $("#passwordNew").val();
	        var passwordNewToo = $("#passwordNeWToo").val();
	        if(passwordNew!=passwordNewToo){
	            clearMessage();
	            showErrorMessage("error-msg_common_password","两次密码不一致");
	            return;
	        }
	        var userId= "${session.userInfo.id!}";
	        $.post("${basePath}/sys/user/updatePassword", {
	            "userId": userId,
	            "passwordOld": passwordOld,
	            "passwordNew": passwordNew
	        }, function (msg) {
	            if (msg == "true") {
	                $("#update_passsword").modal("hide");
	                $("#update_passsword").modal("hideModal");
	                $("#passwordOld").val("");
	                $("#passwordNew").val("");
	                $("#passwordNeWToo").val("");
	                MessageBox.success("修改密码成功");
	                $("#update_passsword").modal("hide");
	            } else {
	                $("#update_passsword").modal("hide");
	                MessageBox.error("修改密码失败");
	            }
	        });
	    });
	</script>
<script src="${basePath}/js/index.js"></script>
</body>
</html>